<html>
<style>
.loader-gmail {
  position: absolute;

  border: 1px solid #a4a4a4;
  width: 200px;
  height: 8px;
  background-color: #09F;
  background-repeat: repeat;
  background-position: 0px 0px;
  background-size: 16px 16px;
  background-clip: content-box;
  padding: 1px;
  animation: loading 1s linear infinite;
}
 
.loader-gmail:after {
  position: absolute;
  right: 0;
  height: 8px;
  background: rgb(245,245,245);
  z-index: 20;
  animation: progress 3s ease-in-out infinite;
  content: '';
}
 
@keyframes loading {
  from {
    background-position: 0px 0px;
  }
  to {
    background-position: -16px 0px;
  }
}
 
@keyframes progress {
  0% {
    min-width: 100%;
  }
  100% {
    min-width: 0;
  }
}

</style>
<body >

<script>


function OnBeforeUnLoad () {
			prevent_bust++
			  
        }
</script> 
<?php 

// function get_redirect_url($url){
    // $redirect_url = null; 
 
    // $url_parts = @parse_url($url);
    // if (!$url_parts) return false;
    // if (!isset($url_parts['host'])) return false; //can't process relative URLs
    // if (!isset($url_parts['path'])) $url_parts['path'] = '/';
      
    // $sock = fsockopen($url_parts['host'], (isset($url_parts['port']) ? (int)$url_parts['port'] : 80), $errno, $errstr, 30);
    // if (!$sock) return false;
      
    // $request = "HEAD " . $url_parts['path'] . (isset($url_parts['query']) ? '?'.$url_parts['query'] : '') . " HTTP/1.1\r\n"; 
    // $request .= 'Host: ' . $url_parts['host'] . "\r\n"; 
    // $request .= "Connection: Close\r\n\r\n"; 
    // fwrite($sock, $request);
    // $response = '';
    // while(!feof($sock)) $response .= fread($sock, 8192);
    // fclose($sock);
 
    // if (preg_match('/^Location: (.+?)$/m', $response, $matches)){
        // if ( substr($matches[1], 0, 1) == "/" )
            // return $url_parts['scheme'] . "://" . $url_parts['host'] . trim($matches[1]);
        // else
            // return trim($matches[1]);
  
    // } else {
        // return false;
    // }
     
// }
 

// function get_all_redirects($url){
    // $redirects = array();
    // while ($newurl = get_redirect_url($url)){
        // if (in_array($newurl, $redirects)){
            // break;
        // }
        // $redirects[] = $newurl;
        // $url = $newurl;
    // }
    // return $redirects;
// }
 
// function get_final_url($url){
    // $redirects = get_all_redirects($url);
    // if (count($redirects)>0){
        // return array_pop($redirects);
    // } else {
        // return $url;
    // }
// }
// ?> 
<div class="loader-gmail"></div>
<?php
	$id=$_REQUEST['id_product'];
	include "connection_open.php";
	$query=mysql_query("select * from `product` where `id`=$id");
	//echo "select * from `product` where `id`=$id";
	if (!$query) 
	{
		die('Invalid query: ' . mysql_error());
	}
	while($row=mysql_fetch_array($query))
	{		
		// $url=$row['url'];
		// $ch = curl_init();
		// curl_setopt($ch, CURLOPT_URL, $url);
		// curl_setopt($ch, CURLOPT_HEADER, true);
		// curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // Must be set to true so that PHP follows any "Location:" header
		// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		// curl_exec($ch);
		// $url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
		// curl_close($ch);
		
		// echo $url;	 
		
		// $rez = get_all_redirects($row['url']);
		// echo $rez;
?>
	<font color="#ff5f00"><span class="url" style="float:right; margin-bottom:15px; border:1px solid #ddd; border-right: none; border-radius:5px; padding:10px" onclick="window.open('<?=$row['url'];?>');"><?=$row['url'];?></span></font>
	<!--<iframe frameborder="0" replaced="true"  width="100%" height="100%" frameborder="0" src="showurl.php?url=<?=$row['url'];?>"></iframe>-->
	<iframe onload="$('.loader-gmail').hide();" replaced="true" sandbox="allow-same-origin allow-forms"  src="<?=$row['url'];?>" width="100%" height="90%" frameborder="0"></iframe>
	
<?php
	}
	include "connection_close.php";
?>	
</body>
</html>